<?php

use Illuminate\Http\Request;
use Illuminate\Support\Facades\Route;

/*
|--------------------------------------------------------------------------
| API Routes
|--------------------------------------------------------------------------
|
| Here is where you can register API routes for your application. These
| routes are loaded by the RouteServiceProvider within a group which
| is assigned the "api" middleware group. Enjoy building your API!
|
*/



Route::namespace('App\Http\Controllers\Api')->group(function () {
    Route::group(['middleware'=>['throttle:1,1']],function(){
        /**发送短信验证码*/
        Route::post('sendSMS', 'Login@sendSMS');
    });


    Route::post('signIn', 'Login@signIn');
    Route::post('regist', 'Login@regist');
    Route::get('getCurrentVersion', 'SystemSetup@getCurrentVersion');
    Route::get('getCompanyName', 'SystemSetup@getCompanyName');





    Route::group(['middleware'=>['connectDB']],function(){

        //账号密码登录
        Route::post('signInPwd', 'Login@signInPwd');
        //员工卡号登录
        Route::post('signInCardNumber', 'NumberExtractor@signInCardNumber')->name('员工抽号机登录');
        //抽号机
        Route::get('getOrderListByEmployeeCardNumnber', 'NumberExtractor@getOrderListByEmployeeCardNumnber')->name('员工输入卡号，查询可领取订单');
        Route::get('getCompletedOrUnfinishedOrderListByEmployeeCardNumnber', 'NumberExtractor@getCompletedOrUnfinishedOrderListByEmployeeCardNumnber')->name('查询已完成，未完成订单');
        Route::post('drawOrderChildByEmployeeCardNumnber', 'NumberExtractor@drawOrderChildByEmployeeCardNumnber')->name('抽号机员工领取订单');
        Route::get('getEpibolyOrderListByEmployeeCardNumnber', 'NumberExtractor@getEpibolyOrderListByEmployeeCardNumnber')->name('员工输入卡号，查询外包订单');
        Route::get('getEpibolyOrderInfo', 'NumberExtractor@getEpibolyOrderInfo')->name('获取外包订单详情');
        Route::get('getOrderChildInfoByEmployeeCardNumnber', 'NumberExtractor@getOrderChildInfoByEmployeeCardNumnber')->name('获取订单详情');
        /**考勤打卡**/
        Route::post("addAppendanceLog","AppendanceLog@addAppendanceLog")->name('员工考勤打卡');

        Route::group(['middleware'=>['checkLogin','userLog','Cors']],function(){


            /**
             * 补考勤
             */
            Route::post("supplementAppendanceLog","AppendanceLog@supplementAppendanceLog")->name('补考勤');


            /**抽号机管理**/
            Route::get('getInvoicesList', 'NumberExtractor@getInvoicesList')->name('获取抽号机单据设置列表');
            Route::post('setInvoicesValue', 'NumberExtractor@setInvoicesValue')->name('设置字段值');
            Route::post('setInvoicesSort', 'NumberExtractor@setInvoicesSort')->name('设置抽号机单据字段顺序');
            /**考勤打卡**/
            Route::get("getAppendanceLogList","AppendanceLog@getAppendanceLogList")->name('获取员工考勤列表');
            /**考勤设置**/
            Route::get("getAppendanceList","Appendance@getAppendanceList")->name('获取考勤设置');
            Route::post("updateAppendance","Appendance@updateAppendance")->name('修改考勤设置');

            /**退出登录**/
            Route::post('logout', 'Login@signOut');
            /**修改密码**/
            Route::post('changePassword', 'Login@changePassword');

            /**产品颜色管理**/
            Route::get('getColorList', 'Color@getColorList')->name('获取产品颜色列表');
            Route::post('createColor', 'Color@createColor')->name('添加，编辑产品颜色');
            Route::post('delColor', 'Color@delColor')->name('删除产品颜色列表');
            /**工种管理**/
            Route::get('getJobTypeList', 'JobType@getJobTypeList')->name('获取工种列表');
            Route::post('createJobType', 'JobType@createJobType')->name('添加，编辑工种');
            Route::post('delJobType', 'JobType@delJobType')->name('删除工种列表');
            Route::get('getUserListByJobTypeId', 'JobType@getUserListByJobTypeId')->name('根据工种ID获取员工列表');
            Route::get('getJobTypeListDropDown', 'JobType@getJobTypeListDropDown')->name('获取工种下拉框');
            /**型号管理**/
            Route::get('getModelNumberList', 'ModelNumber@getModelNumberList')->name('获取型号列表');
            Route::post('createModelNumber', 'ModelNumber@createModelNumber')->name('添加，编辑型号');
            Route::post('addModelNumber', 'ModelNumber@addModelNumber')->name('添加，编辑型号');
            Route::post('delModelNumber', 'ModelNumber@delModelNumber')->name('删除型号列表');
            Route::post('batchAddModelNumber', 'ModelNumber@batchAddModelNumber')->name('批量添加型号');
            Route::post('delProductModelnumber', 'ModelNumber@delProductModelnumber')->name('移除产品型号关联');
            Route::get('getUserListByModelNumberId', 'ModelNumber@getUserListByModelNumberId')->name('获取型号工种关联的员工');
            Route::post('setModelNumberUser', 'ModelNumber@setModelNumberUser')->name('设置型号工种员工关联');
            Route::get('getModelNumberUser', 'ModelNumber@getModelNumberUser')->name('获取型号工种员工关联列表');

            /**规格管理**/
            Route::get('getSpecificationList', 'Specification@getSpecificationList')->name('获取规格列表');
            Route::post('createSpecification', 'Specification@createSpecification')->name('规格，型号关联');
            Route::post('delSpecification', 'Specification@delSpecification')->name('解除规格关联');
            Route::post('setJobTypePriceBySpecificationId', 'Specification@setJobTypePriceBySpecificationId')->name('通过规格设置工种价格');
            Route::get('getJobTypePriceBySpecificationId', 'Specification@getJobTypePriceBySpecificationId')->name('获取规格工种价格');
            Route::post('addSpecification', 'Specification@addSpecification')->name('添加规格');
            Route::post('deleteSpecification', 'Specification@deleteSpecification')->name('删除规格');
            Route::post('batchSetJobTypePrice', 'Specification@batchSetJobTypePrice')->name('同步工种价格');
            Route::get('getSameJobTypeListProductList', 'Specification@getSameJobTypeListProductList')->name('获取相同工种的产品列表');
            Route::post('updateSpecification', 'Specification@updateSpecification')->name('编辑规格');


            /**产品管理**/
            Route::get('getProductList', 'Product@getProductList')->name('获取产品列表');
            Route::post('createProduct', 'Product@createProduct')->name('添加，编辑产品');
            Route::post('delProduct', 'Product@delProduct')->name('删除产品列表');
            Route::get('getProductColorList', 'Product@getProductColorList')->name('获取产品颜色列表');
            Route::post('addProductColor', 'Product@addProductColor')->name('添加产品颜色');
            Route::post('delProductColor', 'Product@delProductColor')->name('删除产品颜色');
            Route::get('getProductJobTypeList', 'Product@getProductJobTypeList')->name('获取产品工序列表');
            Route::post('addProductJobType', 'Product@addProductJobType')->name('添加产品工序');
            Route::post('setProductJobType', 'Product@setProductJobType')->name('设置产品工序');
            Route::post('delProductJobType', 'Product@delProductJobType')->name('删除产品工序');
            Route::post('addJobTypePrice', 'Product@addJobTypePrice')->name('添加产品工种价格');
            Route::get('getModelNumberByProduct', 'Product@getModelNumberByProduct')->name('获取产品关联型号列表');
            Route::get('getProductJobTypeSort', 'Product@getProductJobTypeSort')->name('查看产品工种顺序');
            Route::post('setProductJobTypeSort', 'Product@setProductJobTypeSort')->name('设置产品工种顺序');

            /**客户管理**/
            Route::get('getCustomerList', 'Customer@getCustomerList')->name('获取客户列表');
            Route::post('createCustomer', 'Customer@createCustomer')->name('添加，编辑客户');
            Route::post('delCustomer', 'Customer@delCustomer')->name('删除客户列表');
            Route::post('topUp', 'Customer@topUp')->name('客户余额充值');

            /**员工管理**/
            Route::get('getEmployeeList', 'Employee@getEmployeeList')->name('获取员工列表');
            Route::get('getEmployeeListByJobTypeID', 'Employee@getEmployeeListByJobTypeID')->name('根据job_type_id获取员工列表');
            Route::post('createEmployee', 'Employee@createEmployee')->name('添加，编辑员工');
            Route::post('delEmployee', 'Employee@delEmployee')->name('删除员工列表');


            Route::namespace('Rbac')->group(function () {
                //权限管理
                /** 角色管理*/
                Route::get("getRoleList","Role@getRoleList")->name('获取角色列表');
                Route::post("createRole","Role@createRole")->name('创建角色');
                Route::post("delRole","Role@delRole")->name('删除角色');
                Route::post("setRoleStatus","Role@setRoleStatus")->name('设置角色状态');
                Route::get("getRoleNodeInfo","Role@getRoleNodeInfo")->name('获取角色已分配权限');
                Route::post("allocationNode","Role@allocationNode")->name('分配权限');
                Route::get("getRoleNodeList","Role@getRoleNodeList")->name('获取全部权限列表，标注当前角色已分配的权限');

                Route::get("getYeWuYuanList","Role@getYeWuYuanList")->name('获取角色为业务员的账号列表');
                Route::get("getYuanGongList","Role@getYuanGongList")->name('获取角色为员工的账号列表');
                /** 权限管理*/
                Route::get("getNodeList","Node@getNodeList")->name('获取权限列表');
                Route::post("createNode","Node@createNode")->name('添加、编辑权限');
                Route::post("delNode","Node@delNode")->name('删除权限');
                /**获取左侧菜单*/
                Route::get('getMenu','Node@getMenu')->name('获取左侧菜单');
                Route::get('getMenuAndButton','Node@getMenuAndButton')->name('获取左侧菜单及按钮');
                /** 后台用户管理*/
                Route::get("getUserList","User@getUserList")->name('获取子账号列表');
                Route::post("createUser","User@createUser")->name('创建/编辑账号信息');
                Route::post("setUserStatus","User@setUserStatus")->name('设置账号状态');
                Route::get("getUserInfo","User@getUserInfo")->name('获取管理员详情');
            });

            /**日志管理**/
            Route::get('getUserLogList', 'UserLog@getUserLogList')->name('获取操作日志列表');

            /**订单管理**/
            Route::get('getOrderList', 'Order@getOrderList')->name('获取订单列表');
            Route::post('createOrder', 'Order@createOrder')->name('添加订单');
            Route::post('auditOrder', 'Order@auditOrder')->name('审核订单');
            Route::get('getAuditOrderList', 'Order@getAuditOrderList')->name('获取审核订单列表');
            Route::get('getOrderAuditFlow', 'Order@getOrderAuditFlow')->name('获取订单审核流程');
            Route::get('automaticGenerationSerialNumber', 'Order@automaticGenerationSerialNumber')->name('获取流水号');
            Route::post('delOrder', 'Order@delOrder')->name('删除订单');
            Route::get('automaticGenerationOrderNumber', 'Order@automaticGenerationOrderNumber')->name('获取订单号');

            Route::post('setIsResidualPayment', 'Order@setIsResidualPayment')->name('设置是否已收余款');



            /**子订单管理**/
            Route::get('getOrderChildList', 'OrderChild@getOrderChildList')->name('获取子订单列表');
            Route::post('assignOrderChild', 'OrderChild@assignOrderChild')->name('指派订单');
            Route::post('cancelAssignOrderChild', 'OrderChild@cancelAssignOrderChild')->name('取消指派订单');
            Route::post('epibolyOrderChild', 'OrderChild@epibolyOrderChild')->name('外包订单');
            Route::get('getOrderChildListByOrderId', 'OrderChild@getOrderChildListByOrderId')->name('根据订单ID获取子订单列表');
            Route::post('setOrderChildStatus', 'OrderChild@setOrderChildStatus')->name('设置订单状态为已完成');

            /**打印列表**/
            Route::get('getOrderPrintList', 'OrderPrint@getOrderPrintList')->name('获取打印列表');
            Route::post('addOrderPrint', 'OrderPrint@addOrderPrint')->name('添加打印列表');
            Route::post('orderPrint', 'OrderPrint@orderPrint')->name('打印');
            Route::post('delOrderPrint', 'OrderPrint@delOrderPrint')->name('删除打印');

            /**仓库管理**/
            Route::get('getWarehouseList', 'Warehouse@getWarehouseList')->name('获取仓库列表');
            Route::post('createWarehouse', 'Warehouse@createWarehouse')->name('添加，编辑仓库');
            Route::post('delWarehouse', 'Warehouse@delWarehouse')->name('删除仓库');
            Route::post('createGoodsShelf', 'Warehouse@createGoodsShelf')->name('添加货架');
            Route::post('delGoodsShelf', 'Warehouse@delGoodsShelf')->name('删除货架');


            /**员工端**/
            Route::get('searchPensionableOrderChild', 'Employee@searchPensionableOrderChild')->name('员工获取可领取工单');
            Route::post('drawOrderChild', 'Employee@drawOrderChild')->name('员工领取订单');
            Route::post('submitOrderChild', 'Employee@submitOrderChild')->name('员工提交订单');
            Route::post('submitOrderChildByDayin', 'Employee@submitOrderChildByDayin')->name('打印提交订单');
            Route::get('searchCompletedOrUnfinishedOrderChild', 'Employee@searchCompletedOrUnfinishedOrderChild')->name('查询已完成或未完成的订单');

            /**半成品管理**/
            Route::get('getSemiFinishProductList', 'SemiFinishProduct@getSemiFinishProductList')->name('获取半成品列表');
            Route::post('addFinishProduct', 'SemiFinishProduct@addFinishProduct')->name('半成品加入成品');

            /**成品管理**/
            Route::get('getFinishProductList', 'FinishProduct@getFinishProductList')->name('获取成品列表');
            Route::get('getStockAllocationList', 'FinishProduct@getStockAllocationList')->name('获取可调货的订单列表');
            Route::post('stockAllocation', 'FinishProduct@stockAllocation')->name('调货并记录日志');
            Route::post('setDeliveryStatus', 'FinishProduct@setDeliveryStatus')->name('设置为待发货');
            Route::post('DeliverGoods', 'FinishProduct@DeliverGoods')->name('发货');
            Route::get('getStockUpList', 'FinishProduct@getStockUpList')->name('获取备货列表');
            Route::post('setStockUpStatus', 'FinishProduct@setStockUpStatus')->name('设置备货状态');
            Route::post('deductMoney', 'FinishProduct@deductMoney')->name('成品扣款');
            Route::post('updateFinishProductNum', 'FinishProduct@updateFinishProductNum')->name('修改成品件数');
            Route::post('delFinishProduct', 'FinishProduct@delFinishProduct')->name('成品删除');
            Route::get('getStockAllocationLog', 'FinishProduct@getStockAllocationLog')->name('获取调货列表');
            Route::post('scanQRCodesCheck', 'FinishProduct@scanQRCodesCheck')->name('扫码盘点');
            Route::post('deliveryByScanningCode', 'FinishProduct@deliveryByScanningCode')->name('扫码发货');
            Route::post('cancelDelivery', 'FinishProduct@cancelDelivery')->name('取消待发货');

            /**盘点列表**/
            Route::get('getCheckLogList', 'CheckLog@getCheckLogList')->name('获取盘点列表');
            Route::post('batchSettingYifahuo', 'CheckLog@batchSettingYifahuo')->name('批量设置已发货');



            /**系统设置**/
            Route::get('getOrderAuditList', 'SystemSetup@getOrderAuditList')->name('获取订单审核设置列表');
            Route::post('setOrderAuditStatus', 'SystemSetup@setOrderAuditStatus')->name('设置订单审核设置状态');
            Route::post('setRuleSerialNumber', 'RuleSerialNumber@setRuleSerialNumber')->name('设置订单流水号生成规则');
            Route::get('getRuleSerialNumber', 'RuleSerialNumber@getRuleSerialNumber')->name('获取流水号设置');
            //Route::post('setOrderFieldLogList', 'SystemSetup@setOrderFieldLogList')->name('修改要显示的字段');
            Route::get('getInfomationList', 'SystemSetup@getInfomationList')->name('获取网站基本信息');
            Route::post('setCompanyName', 'SystemSetup@setCompanyName')->name('设置网站基本信息');

            Route::get('getManagementCardList', 'ManagementCard@getManagementCardList')->name('获取抽号机管理卡列表');
            Route::post('createManagementCard', 'ManagementCard@createManagementCard')->name('添加，编辑抽号机管理卡');
            Route::post('delManagementCard', 'ManagementCard@delManagementCard')->name('删除抽号机管理卡');

            Route::get('getOrderFieldLogList', 'OrderFieldLog@getOrderFieldLogList')->name('获取列表要显示的字段列表');
            Route::post('setOrderFieldLogList', 'OrderFieldLog@setOrderFieldLogList')->name('设置列表要显示的字段');

            /**派单顺序管理**/
            Route::get('getDispatchOrderList', 'DispatchOrder@getDispatchOrderList')->name('获取派单顺序列表');
            Route::post('setDispatchOrder', 'DispatchOrder@setDispatchOrder')->name('设置派单顺序');

            /**供应商管理**/
            Route::get('getSupplierList', 'Supplier@getSupplierList')->name('获取供应商列表');
            Route::post('createSupplier', 'Supplier@createSupplier')->name('创建编辑供应商');
            Route::post('delSupplier', 'Supplier@delSupplier')->name('删除供应商');

            /**材料分类管理**/
            Route::get('getMaterialTypeList', 'MaterialType@getMaterialTypeList')->name('获取材料分类列表');
            Route::post('createMaterialType', 'MaterialType@createMaterialType')->name('创建编辑材料分类');
            Route::post('delMaterialType', 'MaterialType@delMaterialType')->name('删除材料分类');

            /**材料规格管理**/
            Route::get('getMaterialSpecificationList', 'MaterialSpecification@getMaterialSpecificationList')->name('获取材料规格列表');
            Route::post('createMaterialSpecification', 'MaterialSpecification@createMaterialSpecification')->name('创建编辑材料规格');
            Route::post('delMaterialSpecification', 'MaterialSpecification@delMaterialSpecification')->name('删除材料规格');


            /**材料管理**/
            Route::get('getMaterialList', 'Material@getMaterialList')->name('获取材料列表');
            Route::post('createMaterial', 'Material@createMaterial')->name('创建编辑材料');
            Route::post('delMaterial', 'Material@delMaterial')->name('删除材料');

            /**入库单**/
            Route::post('createWarehouseOrder', 'WarehouseOrder@createWarehouseOrder')->name('材料入库');
            Route::get('getWarehouseOrderList', 'WarehouseOrder@getWarehouseOrderList')->name('获取出入库记录列表');

            /**首页**/
            Route::get('getIndexHeaderData', 'Index@getIndexHeaderData')->name('获取首页头部统计');
            Route::get('getThirtyDayOrderNumber', 'Index@getThirtyDayOrderNumber')->name('获取近30天数据');
            Route::get('getTOP10Customer', 'Index@getTOP10Customer')->name('获取年度下单TOP10客户');
            Route::get('getAnnualProductOrderNumber', 'Index@getAnnualProductOrderNumber')->name('获取年度产品OP10');
            Route::get('getNearlySexMonthsOrderNumber', 'Index@getNearlySexMonthsOrderNumber')->name('获取近6个月订单量');

            Route::get('getModelNumberTabel', 'Index@getModelNumberTabel')->name('按型号统计订单');
            Route::get('getCustomerTable', 'Index@getCustomerTable')->name('按客户统计订单');


            /**文件上传**/
            Route::post("fileUpload","File@fileUpload")->name('上传文件');
            Route::post("multipleFilesUpload","File@multipleFilesUpload")->name('批量上传文件');

            /**工资列表**/
            Route::get("getSalaryList","Salary@getSalaryList")->name('获取工资列表');
            Route::get("getSalaryInfo","Salary@getSalaryInfo")->name('获取员工工资详情');
            Route::post("changeSalary","Salary@changeSalary")->name('修改员工工资');

            /**流水账列表**/
            Route::get("getBalanceHistoryList","BalanceHistory@getBalanceHistoryList")->name('获取流水账列表');

            /**短信设置**/
            Route::get("getNoteList","Note@getNoteList")->name('获取短信设置列表');
            Route::post("createNote","Note@createNote")->name('修改短信设置');

            /**模型**/
            Route::get("modelIndex","Model@index")->name('模型');
            Route::get("getModelList","Model@getModelList")->name('获取模型列表');
            Route::post("addModel","Model@addModel")->name('添加模型');
            Route::post("addModelField","Model@addModelField")->name('添加字段');
            Route::get("getModelFieldList","Model@getModelFieldList")->name('获取模型字段列表');
            Route::post("updateDefauleFieldShow","Model@updateDefauleFieldShow")->name('模型默认字段显示设置');
            Route::post("delModelField","Model@delModelField")->name('删除字段');
            Route::get("getProductFieldList","Model@getProductFieldList")->name('获取产品字段');





        });
    });















});
